package com.yc.damai.web.remote;

import com.yc.damai.entity.Product;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class OrderActionImpl implements IOrderAction{

    static Map<String,Object> cacheMap = new ConcurrentHashMap<>();

    @Override
    public List<Product> queryNews() {
        return (List<Product>) cacheMap.get("queryNews");
    }

    @Override
    public List<Product> queryHots() {
        return (List<Product>) cacheMap.get("queryHots");
    }

    public static void cache(String name, Object data){
        cacheMap.put(name,data);
    }
}
